react |
您所在的位置:网站首页 › react native 打包 › react |
1.找到项目里的ios文件夹,在此文件夹下新建一个文件夹取名bundle 2.打开终端,cd到项目的根目录 3.执行命令,react-native bundle --entry-file ./index.ios.js --bundle-output ./ios/bundle/index.ios.jsbundle --platform ios --assets-dest ./ios/bundle --dev false 4. 执行完成后,打开第一步创建的bundle文件夹,可以看到 5. 用Xcode打开项目,选中跟项目同名的那个文件夹,右键,选中‘Add Files to ..’选项,然后选择新建的那个bundle文件夹,在弹出的对话框中,点击options,一定要勾选Create folder references选项,将bundle文件夹添加到项目里 6.在AppDelegate.m中的写上加载包的方式 #ifdef DEBUG //开发包 jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil]; #else //离线包 jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"bundle/index.ios" withExtension:@"jsbundle"]; #endif 7.通过Xcode-->Product-->Scheme-->Edit Scheme.的步骤,改成release的状态 8.剩下的步骤就和打包原生iOS一样了,可百度 |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |